package com.spark.zhou.demo.thrift;

import java.sql.*;

/**
 * @Description:
 * @Author: ZhOu
 * @Date: 2018/6/26
 */
public class ThriftServerDemo {
    public static void main(String[] args) throws SQLException {
        try {
            Class.forName("org.apache.hive.jdbc.HiveDriver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        Connection conn = DriverManager.getConnection("jdbc:hive2://node4:10000");
        Statement st = conn.createStatement();
        ResultSet rs = st.executeQuery("SELECT sdk_version AS sdk_version , SUM(increase_count) AS increase_count,SUM(active_count) AS active_count," +
                "SUM(open_count) AS open_count,SUM(show_count) AS show_count FROM ad_sq.ad_app_record_classify_new " +
                "WHERE create_date BETWEEN 20180620 AND 20180626 AND app_id=13 GROUP BY sdk_version ORDER BY sdk_version");
        while (rs.next()) {
            int count1 = rs.getInt(1);
            int count2 = rs.getInt(2);
            int count3 = rs.getInt(3);
            int count4 = rs.getInt(4);
            int count5 = rs.getInt(5);
            System.out.println(count1 + "\t" + count2 + "\t" + count3 + "\t" + count4 + "\t" + count5 + "\t");
        }

    }
}
